<?php
class BusAction extends BaseAction
{
    public function index()
    {

    }

    /**
     * 获取单个商圈信息
     * @author Ice <iceinto@mallog.com.cn>
     */
    public function item()
    {
        $id = $this->_get('id', 'intval');
        if (empty($id)) {
            $this->dataReturn('商圈标识错误', 0, 0);
        } else {
            $data = M('bus')->find($id);
            if (empty($data)) {
                $this->dataReturn('商圈标识错误', 0, 0);
            } else {
                $this->dataReturn($data, 0, 1);
            }
        }
    }

    /**
     * 根据地区编码获取商圈信息
     * @author Ice <iceinto@mallog.com.cn>
     */
    public function items()
    {
        $city = $this->_get('city', 'intval');
        if (empty($city)) {
            $city = 320100;
        }
        $map = array();
        $map['city'] = $city;
        $data = M('bus')->where($map)->select();
        if (empty($data)) {
            $this->dataReturn('当前城市不存在商圈', 0, 0);
        } else {
            $this->dataReturn($data, 0, 1);
        }
    }
}

?>